package com.study.modules.sys.controller;

import com.study.modules.sys.model.entity.SysUser;
import org.apache.shiro.SecurityUtils;

/**
 * @Author Mr.Du
 * @Date 2021/10/19 14:56
 */
public abstract class BaseController {


    /**
     * 获取用户信息
     *
     * @return SysUser
     */
    protected SysUser getUser() {
        return (SysUser) SecurityUtils.getSubject().getPrincipal();
    }

    /**
     * 获取用户id
     *
     * @return id
     */
    protected Long getUserId() {
        SysUser sysUser = (SysUser) SecurityUtils.getSubject().getPrincipal();
        return sysUser.getId();
    }

}
